package com.learning.java.optimize.design.pattern.strategy.impl;

import com.learning.java.optimize.design.pattern.strategy.DiscountStrategy;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * ClassName: SVipDiscountStrategy
 * Description: SVip 折策略
 * Date: 2020/3/22 17:23 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Component
public class SvipDiscountStrategy implements DiscountStrategy {


    private static final String SVIP = "SVIP";
    private static final double SVIP_DISCOUNT = 0.9;

    @Override
    public boolean supportType(String type) {
        return Objects.equals(SVIP, type);
    }

    @Override
    public double discount(double fee) {
        return fee * SVIP_DISCOUNT;
    }

    @Override
    public String type() {
        return SVIP;
    }
}
